<div class="meditbox">
        <form id="m_0_form" onsubmit="return IGLocalSet(this);">
			<input type="hidden" value="<?php echo $gadgetFileName;?>" name="gadget" id="gadgetUrl"/>
            <script></script>
            <table border=0 cellpadding=0 cellspacing=0 width=95% align=center>
<?php
				$i = 0;
				foreach ($gadget->UserPref as $up)
				{
					if ((string)$up['datatype'] != "hidden")
					{
						$name = ((string)$up['name']);
						$displayname = ((string)$up['display_name']);
						$value = $up['default_value'];
						$required = ((string)$up['required']) == "true" ? true : false;

						//Override default UP value with one specified in query string
						@$qValue = $_GET["up_" . $name];
						if ((isset($qValue)) && ($qValue != ""))
						{
							$value = $qValue;
						}
?>
						<tr>
							<td colspan=1 align=right width="35%">
<?php 
								echo $displayname;
								if ($required == true)
								{
									echo '<font color="#ff0000"><sup>*</sup></font>';
								}
?>
							</td>
							<td colspan=2 nowrap align=left width="65%">&nbsp;
<?php

							switch((string) $up['datatype'])
							{
								// Get attributes as element indices
								case 'list':
?>
									<nobr>
										<input type="text" name="m_0_<?php echo $i;?>_up_<?php echo $name; ?>_val" value="" id="m_0_<?php echo $i;?>_val" maxlen="200" size="20"/>
										<input type="button" id="m_0_<?php echo $i;?>_add" onclick="m_0_<?php echo $i;?>_App.add();" value="Add"/>
										<input type="hidden" value="<?php echo $value;?>" name="up_<?php echo $name;?>" id="m_0_<?php echo $i;?>"/>
									</nobr>
								</td>
							</tr>
<?php
							$list = split("\|", $value);
							$items = count($list);
							if ($items > 0)
							{
?>
								<tr>
									<td>
									</td>
									<td>
										<div style="padding-top: 4px;" id="m_0_<?php echo $i;?>_disp">
											<font size="-1">
<?php
									for ($j = 0; $j < $items; $j++)
									{
										echo '<a style="margin: 1px 3px 0px 0px; float: left;" class="delbox" onclick="m_0_<?php echo $i;?>_App._del(1)" href="#"></a>';
										echo $list[$j];
										echo "<br/>";
?>
										
<?php
									}
?>
											</font>
										</div>
									</td>
								</tr>
<?php
							}
									
									break;
								
								case 'bool':
?>
									<input type=hidden id=m_0_<?php echo $i; ?> name=up_<?php echo $name?> value=1><input type=checkbox <?php echo ($value == "false") ? "UNCHECKED" : "CHECKED";  ?> onClick="_gel('m_0_<?php echo $i; ?>').value = this.checked ? '1' : '0';">									
<?php
									break;

								case 'enum':
								default:
?>
									<input type="text" size="20" maxlen="200" id=m_0_<?php echo $i; ?> name=up_<?php echo $name?> value="<?php echo $value?>">
<?php

							}

							
?>
							</td>
						</tr>
<?php
					$i++;
					}
				}
?>
                
            </table>

            <table border=0 cellpadding=0 cellspacing=0 width=95% align=center>
                <tr>
                    <td colspan=2 nowrap align=left><br><a href=""><font size=-1 color=#7777cc></font></a></td>
                    <td colspan=1 align=right valign=bottom>
                        <input id=m_0_numfields type=hidden value=19><input id=save_0 class=submitbtn type=submit value="Save"><input type=button value="Cancel" onclick="return _cedit('0')">
                    </td>
                </tr>
            </table>
        </form>

    </div>